package com.cloud.base.jvm;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class JvmMain {
    // 打印GC日志 -Xms20m  -Xmx20m  -XX:+PrintGCDetails -verbose:gc
    //新生代日志，新生代回收前占用1321K，回收后627K
    //[GC (Allocation Failure) [DefNew: 1321K->627K(6144K), 0.0019086 secs][Tenured: 0K->626K(13696K), 0.0020226 secs] 1321K->626K(19840K), [Metaspace: 205K->205K(4480K)], 0.0039861 secs] [Times: user=0.01 sys=0.00, real=0.00 secs]
    //老年代gc回收，也会触发新生代GC回收。
    //[Full GC (Allocation Failure) [Tenured: 626K->611K(13696K), 0.0022877 secs] 626K->611K(19840K), [Metaspace: 205K->205K(4480K)], 0.0023122 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
    public static void main(String[] args) throws IOException {
        List listc = new ArrayList();
        listc.add(new byte[20 * 1024 * 1024]);
        System.out.println(System.getProperty("name"));
        try {
            int i =1/0;
        } catch (Exception e) {
            System.out.println("第一层catch");
            try {
                int j =1/0;
            }
            catch (Exception ex){
                System.out.println("第二层catch");
            }
            finally {
                System.out.println("第二层finally");
            }
        } finally {
            System.out.println("第一层finally");
        }


    }
}
